/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.phoenix.repository;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.AccessControlException;
import java.util.HashMap;
import java.util.Map;

import javax.jcr.InvalidSerializedDataException;
import javax.jcr.ItemExistsException;
import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.UnsupportedRepositoryOperationException;
import javax.jcr.lock.LockException;
import javax.jcr.nodetype.ConstraintViolationException;
import javax.jcr.retention.RetentionManager;
import javax.jcr.security.AccessControlManager;
import javax.jcr.version.VersionException;

import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;

/**
 * Jigsaw server
 * 
 * @author <a href="shamphone@gmail.com">Li XiongFeng</a>
 * @date 2012-5-24
 * @version 1.0.0
 */
public abstract class GeneralSession implements Session {
	protected Map<String, Object> attributes;
	public GeneralSession(){
		this.attributes = new HashMap<String, Object>();
	}
	
	@Override
	public String[] getAttributeNames() {
		 return attributes.keySet().toArray(new String[attributes.size()]);
	}

	@Override
	public Object getAttribute(String name) {
		 return attributes.get(name);
	}



	@Override
	public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException {
		return this.getNodeByIdentifier(uuid);
	}

	

	@Override
	public boolean hasPermission(String absPath, String actions) throws RepositoryException {
		return false;
	}

	@Override
	public void checkPermission(String absPath, String actions) throws AccessControlException, RepositoryException {
		// TODO Auto-generated method stub

	}

	@Override
	public boolean hasCapability(String methodName, Object target, Object[] arguments) throws RepositoryException {
		return false;
	}

	@Override
	public ContentHandler getImportContentHandler(String parentAbsPath, int uuidBehavior) throws PathNotFoundException, ConstraintViolationException, VersionException, LockException,
			RepositoryException {
		return null;
	}

	@Override
	public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, PathNotFoundException, ItemExistsException, ConstraintViolationException, VersionException,
			InvalidSerializedDataException, LockException, RepositoryException {

	}

	@Override
	public void exportSystemView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException {

	}

	@Override
	public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException {

	}

	@Override
	public void exportDocumentView(String absPath, ContentHandler contentHandler, boolean skipBinary, boolean noRecurse) throws PathNotFoundException, SAXException, RepositoryException {

	}

	@Override
	public void exportDocumentView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse) throws IOException, PathNotFoundException, RepositoryException {

	}

	

	@Override
	public void addLockToken(String lt) {

	}

	@Override
	public String[] getLockTokens() {
		return null;
	}

	@Override
	public void removeLockToken(String lt) {

	}

	@Override
	public AccessControlManager getAccessControlManager() throws UnsupportedRepositoryOperationException, RepositoryException {
		return null;
	}

	@Override
	public RetentionManager getRetentionManager() throws UnsupportedRepositoryOperationException, RepositoryException {
		return null;
	}

}
